﻿@model Telecom.Data.CARD

@{  AjaxOptions ajaxOpts = new AjaxOptions
    {
        HttpMethod = "post",
        OnComplete = "completedAjaxRequestCard"
    };
}

<script type="text/javascript">

    function opBeginProcess_loading_window_submit() {
        $("#ContentwindowFunction").mask("Dữ liệu đang xử lý");
    }

    function completedAjaxRequestCard(obj) {

        var returnObj = eval('(' + obj.responseText + ')');

        if (returnObj.Status == "success") {


            var $rowReload = $('#thietbi_TableContainer').jtable('getRowByKey', $("#DMTHIETBI_AdUpTb").val());
            $rowReload.next().find('.jtable-child-table-container').jtable('reload')

            close_window_elements('window_addupdate_Card_thietbi');


        } else {

            $("#ContentwindowFunction").unmask();
            confirmOptionNormal(returnObj.Message);
        }

        return false;

    }

     $(document).ready(function () {

         $("#DMTHIETBIAdUpTB").combobox({
             url: _nameSubDomain + "/Dm_ThietBi/ListThietBiInJson",
                valueField: "ID",
                textField: "TEN",
                onSelect: function (row) {
                    $("#LOAIPORT_AdUpTb").val(row.ID);
                }

            });

         $("#LOAIPORTAdUpTB").combobox({
             url: _nameSubDomain + "/Dm_ThietBi/ListJsonLoaiPort",
                valueField: "MA",
                textField: "TEN",
                onSelect: function (row) {
                    $("#LOAIPORT_AdUpTb").val(row.MA);
                }
            
            });

            

        });

        function loadDatainToLoaiTB(ma) {
            $("#loaiTBAdUpTB").combobox({ url: _nameSubDomain + "/Dm_ThietBi/ListLoaiTb?ma=" + ma });
        }

</script>

@using (Ajax.BeginForm("AdUpCard", "Dm_ThietBi", null, ajaxOpts, new { enctype = "multipart/form-data" }))
{
    @Html.HiddenFor(model => model.ID, new { id = "IdAddUpdaCard" })
    @Html.HiddenFor(model => model.DMTHIETBI, new { id = "DMTHIETBI_AdUpTb" })
    @Html.HiddenFor(model => model.LOAIPORT, new { id = "LOAIPORT_AdUpTb" })
    
    <div id="ContentwindowFunction" class="ContentwindowFunction">
       <table class="tableContentWindowFunction">
           <tr>
                <td>
                   Thiết Bị
                </td>
               <td>
                    <input class="easyui-combobox" value="@Model.DMTHIETBI" style="width:450px; height:27px" id="DMTHIETBIAdUpTB" name="DMTHIETBIAdUpTB">
               </td>
           </tr>
           <tr>
                <td>
                    Tên Card
                </td>
               <td>
                   @Html.TextBoxFor(model => model.TEN, new { @class = "input_table_function"})
               </td>
           </tr>
           <tr>
                <td>
                    Loại Port
                </td>
               <td>
                   <input class="easyui-combobox" value="@Model.LOAIPORT" style="width:450px; height:27px" id="LOAIPORTAdUpTB" name="LOAIPORTAdUpTB">
               </td>
           </tr>
           <tr>
                <td>
                    Số Port
                </td>
               <td>
                   @Html.TextBoxFor(model => model.SOPORT, new { @class = "input_table_function"})
               </td>
           </tr>
           <tr>
                <td>
                    Ghi Chú
                </td>
               <td>
                   @Html.TextAreaFor(model => model.GHICHU, new { @class = "input_table_function"})
               </td>
           </tr>
       </table>
        <div style="height:30px"></div>
        <div class="footer_submit" style="margin-top: 10px; text-align: center">
            <button type="submit" onclick="return opBeginProcess_loading_window_submit(); ">
                <span class="l-btn-left l-btn-icon-left"><span class="l-btn-text">Cập nhật Card</span><span class="l-btn-icon icon-add">&nbsp;</span></span>    
            </button>
            <button type="button" onclick="return close_window_elements('window_addupdate_Card_thietbi');" >
                <span class="l-btn-left l-btn-icon-left"><span class="l-btn-text">Hủy bỏ</span><span class="l-btn-icon icon-remove">&nbsp;</span></span></button>
        </div>
    </div>
    

}